package memento.pattern.demo;

import com.sun.org.apache.xpath.internal.operations.Or;

public class MementoPatternEx {
    public static void main(String[] args) {
        System.out.println("***Memento Pattern Demo***");
        Originator o = new Originator();
        o.setState("First state");

        // HOlding Old state
        Caretaker c = new Caretaker();
        c.saveMemento(o.orginatorMemento());

        //change state
        o.setState("Second state");

        //Restore saved state
        o.Revert(c.RetrieveMemento());
    }
}
